﻿using MiniExcelLibs;
using PanhuaWin.NCModel;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PanhuaWin.通用
{
    public partial class FormMsg : UIForm
    {
        public List<更新存货编号结果> 更新存货编号结果List { get; set; }
        public FormMsg()
        {
            InitializeComponent();
        }
        public FormMsg(List<更新存货编号结果> 更新存货编号结果List )
        {
            InitializeComponent();
            this.更新存货编号结果List = 更新存货编号结果List;
        }

        private void FormMsg_Load(object sender, EventArgs e)
        {
            BindingSource bs = new BindingSource();
            bs.DataSource = 更新存货编号结果List;
            uiDataGridView结果.DataSource = bs;
        }

        private void uiButton导出_Click(object sender, EventArgs e)
        {
            string path;
            this.saveFileDialog1.Filter = "Excel 文件(*.xlsx)|*.xlsx ";
            if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
            {
                path = this.saveFileDialog1.FileName;
                if (!File.Exists(path))
                {
                    MiniExcel.SaveAs(path, 更新存货编号结果List, true);
                }
                else
                {
                    MessageBox.Show("文件已经存在,请重试!", "提示", MessageBoxButtons.OK);
                    return;
                }

            }
        }
    }
}
